home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_8.lha / 7_8 / tst.c < prev    next >
Text File  |  1993-08-08  |  959b  |  44 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include "7_8decl.h"
  6.  
  7. include <stream.h>
  8.  
  9. ypedef void *Ent;
  10.  
  11. eclare(gdlink,Ent)
  12. eclare(gdlist,Ent)
  13. mplement(gdlink,Ent)
  14. mplement(gdlist,Ent)
  15.  
  16. ain()
  17.  
  18.    gdlist(Ent) xdlist("hello");
  19.    xdlist.append("there");
  20.    xdlist.append("how");
  21.    xdlist.append("are");
  22.    xdlist.append("you");
  23.    xdlist.append("today");
  24.    void *x;
  25.    cout << "forwards\n";
  26.    while (xdlist.next(x))
  27. cout << "'" << (char*)x << "'\n";
  28.    cout << "\nbackwards\n";
  29.    while (xdlist.prev(x))
  30. cout << "'" << (char*)x << "'\n";
  31.    xdlist.next(x);
  32.    xdlist.next(x);
  33.    xdlist.inserthere("Beep");
  34.    xdlist.appendhere("Boop");
  35.    xdlist.reset();
  36.    cout << "\nforwards, removing\n";
  37.    while (xdlist.getnext(x))
  38. cout << "'" << (char*)x << "'\n";
  39.    cout << "\nbackwards\n";
  40.    while (xdlist.getprev(x))
  41. cout << "'" << (char*)x << "'\n";
  42.    return 0;
  43.  
  44.